package cn.hsa.xxx.bookData.controller;


import cn.hsa.hsaf.core.framework.web.WrapperResponse;
import cn.hsa.xxx.api.dto.ShelvesApprovalProcessDTO;
import cn.hsa.xxx.api.service.ShelvesApprovalProcessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/web/bookData/shelvesApprovalProcess")
@RestController
@Slf4j
public class ShelvesApprovalProcessController {

    @Autowired
    private ShelvesApprovalProcessService shelvesApprovalProcessService;

    @PostMapping("/addShelvesApprovalProcess")
    public WrapperResponse<ShelvesApprovalProcessDTO> addShelvesApprovalProcess(@RequestBody ShelvesApprovalProcessDTO shelvesApprovalProcessDTO) {
        ShelvesApprovalProcessDTO result = shelvesApprovalProcessService.add(shelvesApprovalProcessDTO);
        return WrapperResponse.success(result);
    }

    @PostMapping("/deleteShelvesApprovalProcess")
    public WrapperResponse<String> deleteShelvesApprovalProcess(@RequestParam String id) {
        String result = shelvesApprovalProcessService.delete(id);
        return WrapperResponse.success(result);
    }

    @GetMapping("/getShelvesApprovalProcessById")
    public WrapperResponse<ShelvesApprovalProcessDTO> getShelvesApprovalProcess(@RequestParam String id) {
        ShelvesApprovalProcessDTO result = shelvesApprovalProcessService.get(id);
        return WrapperResponse.success(result);
    }

    @PostMapping("/updateShelvesApprovalProcess")
    public WrapperResponse<String> updateShelvesApprovalProcess(@RequestBody ShelvesApprovalProcessDTO shelvesApprovalProcessDTO) {
        String str = shelvesApprovalProcessService.update(shelvesApprovalProcessDTO);
        return WrapperResponse.success(str);
    }

    @GetMapping("/page")
    public WrapperResponse<List<ShelvesApprovalProcessDTO>> getPageShelvesApprovalProcess(int pageNo, int pageSize) {
        List<ShelvesApprovalProcessDTO> shelvesApprovalProcessDTOList = shelvesApprovalProcessService.getPage(pageNo, pageSize);
        return WrapperResponse.success(shelvesApprovalProcessDTOList);
    }
}
